#include "modfirstinfo.h"
#include "ui_modfirstinfo.h"
#include "mainwindow.h"

modFirstInfo::modFirstInfo(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::modFirstInfo)
{
    ui->setupUi(this);
}

//既往疾病
void modFirstInfo::on_radioButton_2_clicked()
{
    ui->widget_23->show();
}
void modFirstInfo::on_radioButton_clicked()
{
    ui->widget_23->hide();
}

//目前伴随疾病
void modFirstInfo::on_radioButton_4_clicked()
{
    ui->widget_27->show();
}
void modFirstInfo::on_radioButton_3_clicked()
{
    ui->widget_27->hide();
}

//胸腺疾病
void modFirstInfo::on_radioButton_6_clicked()
{
    ui->textEdit->show();
}
void modFirstInfo::on_radioButton_5_clicked()
{
    ui->textEdit->hide();
}

//肌无力危像
void modFirstInfo::on_radioButton_8_clicked()
{
    ui->textEdit_3->show();
}
void modFirstInfo::on_radioButton_7_clicked()
{
    ui->textEdit_3->hide();
}

//抗体
void modFirstInfo::on_radioButton_9_clicked()
{
    ui->widget_26->show();
}
void modFirstInfo::on_radioButton_10_clicked()
{
    ui->widget_26->hide();
}

//抽血
void modFirstInfo::on_radioButton_12_clicked()
{
    ui->widget_24->show();
}
void modFirstInfo::on_radioButton_11_clicked()
{
    ui->widget_24->hide();
}

//技检
void modFirstInfo::on_radioButton_14_clicked()
{
    ui->widget_25->show();
}
void modFirstInfo::on_radioButton_13_clicked()
{
    ui->widget_25->hide();
}

//MGFA
void modFirstInfo::on_radioButton_16_clicked()
{
    ui->widget_20->show();
}
void modFirstInfo::on_radioButton_15_clicked()
{
    ui->widget_20->hide();
}

modFirstInfo::load(QString visit_time, QString first_symptom, int first_age, QString elapsed_time, QString height, QString weight, QString smoking_history, QString previous_illnesses, QString comorbidity, QString thymic_disease, QString myasthenia, QString antibody_test, QString blood_test, QString technical_inspection, QString scale_evaluation1, QString scale_evaluation2, QString diagnosis1, QString diagnosis2, QString treatment_plan, QString MGFA)
{
    ui->lineEdit->clear();
    ui->lineEdit_3->clear();
    ui->lineEdit_4->clear();
    ui->lineEdit_5->clear();
    ui->lineEdit_6->clear();
    ui->lineEdit_7->clear();
    ui->textEdit_2->clear();
    ui->textEdit_4->clear();
    ui->textEdit_5->clear();
    ui->label_20->clear();
    ui->label_21->clear();
    ui->label_22->clear();
    ui->textEdit->clear();
    ui->textEdit_3->clear();
    ui->label_23->clear();
    ui->label_24->clear();
    ui->lineEdit_2->clear();
    ui->lineEdit_8->clear();

    ui->lineEdit->setText(visit_time);
    ui->lineEdit_3->setText(QString::number(first_age));
    ui->lineEdit_4->setText(elapsed_time);
    ui->lineEdit_5->setText(height);
    ui->lineEdit_6->setText(weight);
    ui->lineEdit_7->setText(smoking_history);
    ui->textEdit_2->setText(scale_evaluation1);
    ui->textEdit_4->setText(diagnosis1);
    ui->textEdit_5->setText(treatment_plan);
    ui->checkBox->setChecked(false);
    ui->checkBox_2->setChecked(false);
    ui->checkBox_3->setChecked(false);
    ui->checkBox_4->setChecked(false);
    ui->checkBox_5->setChecked(false);
    ui->checkBox_6->setChecked(false);
    ui->checkBox_7->setChecked(false);
    ui->checkBox_8->setChecked(false);
    ui->checkBox_9->setChecked(false);
    ui->checkBox_10->setChecked(false);
    ui->checkBox_11->setChecked(false);
    ui->checkBox_12->setChecked(false);
    ui->checkBox_13->setChecked(false);
    ui->checkBox_14->setChecked(false);
    ui->checkBox_15->setChecked(false);
    ui->checkBox_16->setChecked(false);
    ui->checkBox_17->setChecked(false);
    ui->checkBox_18->setChecked(false);
    ui->checkBox_19->setChecked(false);
    ui->checkBox_20->setChecked(false);
    ui->checkBox_21->setChecked(false);
    ui->checkBox_22->setChecked(false);
    ui->checkBox_23->setChecked(false);
    ui->checkBox_24->setChecked(false);
    ui->checkBox_25->setChecked(false);
    ui->radioButton_15->setChecked(false);
    ui->radioButton_16->setChecked(false);
    ui->radioButton_17->setChecked(false);
    ui->radioButton_18->setChecked(false);
    ui->radioButton_19->setChecked(false);
    ui->radioButton_20->setChecked(false);
    ui->radioButton_21->setChecked(false);
    ui->radioButton_22->setChecked(false);
    ui->radioButton_23->setChecked(false);
    ui->radioButton_24->setChecked(false);

    ui->widget_23->hide();
    ui->widget_27->hide();
    ui->textEdit->hide();
    ui->textEdit_3->hide();
    ui->widget_24->hide();
    ui->widget_25->hide();
    ui->widget_26->hide();
    ui->widget_20->hide();

    QStringList list = comorbidity.split("、");
    if(list.size() == 0 || (list.size() == 1 && QString::compare(list[0], "") == 0))
    {
        ui->radioButton_3->setChecked(true);
    }
    else
    {
        ui->radioButton_4->setChecked(true);
        ui->widget_27->show();
        QString text = "";
        for(int i = 0; i < list.size(); i++)
        {
            if(QString::compare(list[i], ui->checkBox_15->text()) == 0)
            {
                ui->checkBox_15->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_16->text()) == 0)
            {
                ui->checkBox_16->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_17->text()) == 0)
            {
                ui->checkBox_17->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_18->text()) == 0)
            {
                ui->checkBox_18->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_19->text()) == 0)
            {
                ui->checkBox_19->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_20->text()) == 0)
            {
                ui->checkBox_20->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_21->text()) == 0)
            {
                ui->checkBox_21->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_22->text()) == 0)
            {
                ui->checkBox_22->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_23->text()) == 0)
            {
                ui->checkBox_23->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_24->text()) == 0)
            {
                ui->checkBox_24->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_25->text()) == 0)
            {
                ui->checkBox_25->setChecked(true);
                continue;
            }
            text += list[i];
        }
        ui->lineEdit_8->setText(text);
    }

    list = previous_illnesses.split("、");
    if(list.size() == 0 || (list.size() == 1 && QString::compare(list[0], "") == 0))
    {
        ui->radioButton->setChecked(true);
    }
    else
    {
        ui->radioButton_2->setChecked(true);
        ui->widget_23->show();
        QString text = "";
        for(int i = 0; i < list.size(); i++)
        {
            if(QString::compare(list[i], ui->checkBox_10->text()) == 0)
            {
                ui->checkBox_10->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_11->text()) == 0)
            {
                ui->checkBox_11->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_12->text()) == 0)
            {
                ui->checkBox_12->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_13->text()) == 0)
            {
                ui->checkBox_13->setChecked(true);
                continue;
            }
            if(QString::compare(list[i], ui->checkBox_14->text()) == 0)
            {
                ui->checkBox_14->setChecked(true);
                continue;
            }
            text += list[i];
        }
        ui->lineEdit_2->setText(text);
    }

    list = first_symptom.split("、");
    for(int i = 0; i < list.size(); i++)
    {
        if(QString::compare(list[i], ui->checkBox->text()) == 0)
        {
            ui->checkBox->setChecked(true);
            continue;
        }
        if(QString::compare(list[i], ui->checkBox_2->text()) == 0)
        {
            ui->checkBox_2->setChecked(true);
            continue;
        }
        if(QString::compare(list[i], ui->checkBox_3->text()) == 0)
        {
            ui->checkBox_3->setChecked(true);
        }
        if(QString::compare(list[i], ui->checkBox_4->text()) == 0)
        {
            ui->checkBox_4->setChecked(true);
            continue;
        }
        if(QString::compare(list[i], ui->checkBox_5->text()) == 0)
        {
            ui->checkBox_5->setChecked(true);
            continue;
        }
        if(QString::compare(list[i], ui->checkBox_6->text()) == 0)
        {
            ui->checkBox_6->setChecked(true);
            continue;
        }
        if(QString::compare(list[i], ui->checkBox_7->text()) == 0)
        {
            ui->checkBox_7->setChecked(true);
            continue;
        }
        if(QString::compare(list[i], ui->checkBox_8->text()) == 0)
        {
            ui->checkBox_8->setChecked(true);
            continue;
        }
        if(QString::compare(list[i], ui->checkBox_9->text()) == 0)
        {
            ui->checkBox_9->setChecked(true);
            continue;
        }
    }

    if(QString::compare(antibody_test, "") == 0)
    {
        ui->radioButton_10->setChecked(true);
    }
    else
    {
        ui->radioButton_9->setChecked(true);
        ui->widget_26->show();
        QImage image;
        image.load(antibody_test);
        QPixmap pixmap = QPixmap::fromImage(image);
        int width = ui->label_20->width();
        int height = ui->label_20->height();
        QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
        ui->label_20->setPixmap(fitpixmap);
        antibody_path = antibody_test;
    }

    if(QString::compare(blood_test, "") == 0)
    {
        ui->radioButton_11->setChecked(true);
    }
    else
    {
        ui->radioButton_12->setChecked(true);
        ui->widget_24->show();
        QImage image;
        image.load(blood_test);
        QPixmap pixmap = QPixmap::fromImage(image);
        int width = ui->label_21->width();
        int height = ui->label_21->height();
        QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
        ui->label_21->setPixmap(fitpixmap);
        blood_path = blood_test;
    }

    if(QString::compare(technical_inspection, "") == 0)
    {
        ui->radioButton_13->setChecked(true);
    }
    else
    {
        ui->radioButton_14->setChecked(true);
        ui->widget_25->show();
        QImage image;
        image.load(technical_inspection);
        QPixmap pixmap = QPixmap::fromImage(image);
        int width = ui->label_22->width();
        int height = ui->label_22->height();
        QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
        ui->label_22->setPixmap(fitpixmap);
        technical_path = technical_inspection;
    }

    if(QString::compare(thymic_disease, "") == 0)
    {
        ui->radioButton_5->setChecked(true);
    }
    else
    {
        ui->radioButton_6->setChecked(true);
        ui->textEdit->show();
        ui->textEdit->setText(thymic_disease);
    }

    if(QString::compare(myasthenia, "") == 0)
    {
        ui->radioButton_7->setChecked(true);
    }
    else
    {
        ui->radioButton_8->setChecked(true);
        ui->textEdit_3->show();
        ui->textEdit_3->setText(myasthenia);
    }

    if(QString::compare(scale_evaluation2, "") != 0)
    {
        QImage image;
        image.load(scale_evaluation2);
        QPixmap pixmap = QPixmap::fromImage(image);
        int width = ui->label_23->width();
        int height = ui->label_23->height();
        QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
        ui->label_23->setPixmap(fitpixmap);
        scale_path = scale_evaluation2;
    }

    if(QString::compare(diagnosis2, "") != 0)
    {
        QImage image;
        image.load(diagnosis2);
        QPixmap pixmap = QPixmap::fromImage(image);
        int width = ui->label_24->width();
        int height = ui->label_24->height();
        QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
        ui->label_24->setPixmap(fitpixmap);
        diagnosis_path = diagnosis2;
    }

    if(QString::compare(MGFA, "") == 0)
    {
        ui->radioButton_15->setChecked(true);
    }
    else
    {
        ui->radioButton_16->setChecked(true);
        ui->widget_20->show();
        if(QString::compare(MGFA, ui->radioButton_17->text()))
        {
            ui->radioButton_17->setChecked(true);
        }else if(QString::compare(MGFA, ui->radioButton_18->text()))
        {
            ui->radioButton_18->setChecked(true);
        }else if(QString::compare(MGFA, ui->radioButton_19->text()))
        {
            ui->radioButton_19->setChecked(true);
        }else if(QString::compare(MGFA, ui->radioButton_20->text()))
        {
            ui->radioButton_20->setChecked(true);
        }else if(QString::compare(MGFA, ui->radioButton_21->text()))
        {
            ui->radioButton_21->setChecked(true);
        }else if(QString::compare(MGFA, ui->radioButton_22->text()))
        {
            ui->radioButton_22->setChecked(true);
        }else if(QString::compare(MGFA, ui->radioButton_23->text()))
        {
            ui->radioButton_23->setChecked(true);
        }else if(QString::compare(MGFA, ui->radioButton_24->text()))
        {
            ui->radioButton_24->setChecked(true);
        }
    }
}

modFirstInfo::~modFirstInfo()
{
    delete ui;
}

void modFirstInfo::on_btn_cancel_clicked()
{
    this->hide();
}

void modFirstInfo::on_btn_submit_clicked()
{
    QString time = ui->lineEdit->text();  //就诊时间
    QString symptom = "";  //首发症状
    bool flag = false;
    if(ui->checkBox->checkState())
    {
        if(flag)
        {
            symptom += "、";
        }
        symptom += ui->checkBox->text();
        flag = true;
    }
    if(ui->checkBox_2->checkState())
    {
        if(flag)
        {
            symptom += "、";
        }
        symptom += ui->checkBox_2->text();
        flag = true;
    }
    if(ui->checkBox_3->checkState())
    {
        if(flag)
        {
            symptom += "、";
        }
        symptom += ui->checkBox_3->text();
        flag = true;
    }
    if(ui->checkBox_4->checkState())
    {
        if(flag)
        {
            symptom += "、";
        }
        symptom += ui->checkBox_4->text();
        flag = true;
    }
    if(ui->checkBox_5->checkState())
    {
        if(flag)
        {
            symptom += "、";
        }
        symptom += ui->checkBox_5->text();
        flag = true;
    }
    if(ui->checkBox_6->checkState())
    {
        if(flag)
        {
            symptom += "、";
        }
        symptom += ui->checkBox_6->text();
        flag = true;
    }
    if(ui->checkBox_7->checkState())
    {
        if(flag)
        {
            symptom += "、";
        }
        symptom += ui->checkBox_7->text();
        flag = true;
    }
    if(ui->checkBox_8->checkState())
    {
        if(flag)
        {
            symptom += "、";
        }
        symptom += ui->checkBox_8->text();
        flag = true;
    }
    if(ui->checkBox_9->checkState())
    {
        if(flag)
        {
            symptom += "、";
        }
        symptom += ui->checkBox_9->text();
        flag = true;
    }
    QString age = ui->lineEdit_3->text();  //年龄
    QString passtime = ui->lineEdit_4->text();  //经历时间
    QString height = ui->lineEdit_5->text();  //身高
    QString weight = ui->lineEdit_6->text();  //体重
    QString smoke = ui->lineEdit_7->text();  //吸烟史
    QString pill = "";  //首发疾病
    flag = false;
    if(ui->radioButton->isChecked())
    {
        pill = "";
    }
    else if(ui->radioButton_2->isChecked())
    {
        if(ui->checkBox_10->checkState())
        {
            if(flag)
            {
                pill += "、";
            }
            pill += ui->checkBox_10->text();
            flag = true;
        }
        if(ui->checkBox_11->checkState())
        {
            if(flag)
            {
                pill += "、";
            }
            pill += ui->checkBox_11->text();
            flag = true;
        }
        if(ui->checkBox_12->checkState())
        {
            if(flag)
            {
                pill += "、";
            }
            pill += ui->checkBox_12->text();
            flag = true;
        }
        if(ui->checkBox_13->checkState())
        {
            if(flag)
            {
                pill += "、";
            }
            pill += ui->checkBox_13->text();
            flag = true;
        }
        if(ui->checkBox_14->checkState())
        {
            if(flag)
            {
                pill += "、";
            }
            pill += ui->checkBox_14->text();
            flag = true;
        }
        if(flag)
        {
            pill += "";
        }
        pill += ui->lineEdit_2->text();
    }
    QString cill = "";  //伴随疾病
    flag = false;
    if(ui->radioButton_3->isChecked())
    {
        cill = "";
    }
    else if(ui->radioButton_4->isChecked())
    {
        if(ui->checkBox_15->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_15->text();
            flag = true;
        }
        if(ui->checkBox_16->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_16->text();
            flag = true;
        }
        if(ui->checkBox_17->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_17->text();
            flag = true;
        }
        if(ui->checkBox_18->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_18->text();
            flag = true;
        }
        if(ui->checkBox_19->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_19->text();
            flag = true;
        }
        if(ui->checkBox_20->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_20->text();
            flag = true;
        }
        if(ui->checkBox_21->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_21->text();
            flag = true;
        }
        if(ui->checkBox_22->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_22->text();
            flag = true;
        }
        if(ui->checkBox_23->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_23->text();
            flag = true;
        }
        if(ui->checkBox_24->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_24->text();
            flag = true;
        }
        if(ui->checkBox_25->checkState())
        {
            if(flag)
            {
                cill += "、";
            }
            cill += ui->checkBox_25->text();
            flag = true;
        }
        if(flag)
        {
            cill += "、";
        }
        cill += ui->lineEdit_8->text();
    }
    QString till = "";  //胸腺疾病
    if(ui->radioButton_5->isChecked())
    {
        till = "";
    }
    else if(ui->radioButton_6->isChecked())
    {
        till += ui->textEdit->toPlainText();
    }
    QString mill = "";  //肌无力
    if(ui->radioButton_7->isChecked())
    {
        mill = "";
    }
    else if(ui->radioButton_8->isChecked())
    {
        mill += ui->textEdit_3->toPlainText();
    }
    QString scale = ui->textEdit_2->toPlainText();  //量表
    QString diagnosis = ui->textEdit_4->toPlainText();  //诊断
    QString method = ui->textEdit_5->toPlainText();  //治疗方案
    QString MGFA = "";  //MGFA
    if(ui->radioButton_15->isChecked())
    {
        MGFA = "无干预";
    }
    else if(ui->radioButton_17->isChecked())
    {
        MGFA = "完全缓解";
    }
    else if(ui->radioButton_18->isChecked())
    {
        MGFA = "药物缓解";
    }
    else if(ui->radioButton_19->isChecked())
    {
        MGFA = "微小缓解";
    }
    else if(ui->radioButton_20->isChecked())
    {
        MGFA = "改善";
    }
    else if(ui->radioButton_21->isChecked())
    {
        MGFA = "无变化";
    }
    else if(ui->radioButton_22->isChecked())
    {
        MGFA = "加重";
    }
    else if(ui->radioButton_23->isChecked())
    {
        MGFA = "恶化";
    }
    else if(ui->radioButton_24->isChecked())
    {
        MGFA = "死亡";
    }
    auto ptr = MainWindow::getinstance();
    QString id = ptr->us.getUserSqlId();
//    ptr->addFirstInfoById(id, time, symptom, age, passtime, height, weight, smoke, pill, cill, till, mill, antibody_path, blood_path, technical_path, scale, scale_path, diagnosis, diagnosis_path, method, MGFA);
    ptr->updateFirstInfoById(id, time, symptom, age, passtime, height, weight, smoke, pill, cill, till, mill, antibody_path, blood_path, technical_path, scale, scale_path, diagnosis, diagnosis_path, method, MGFA);
    Info info = ptr->getFirstInfoById(id.toInt());
    ptr->us.load(info);
    this->hide();
    ptr = nullptr;
}

//抗体图片上传
void modFirstInfo::on_pushButton_clicked()
{
    antibody_path = QFileDialog::getOpenFileName(nullptr, "文件上传", "", "");
    qDebug() << antibody_path;
    QImage image;
    image.load(antibody_path);
    QPixmap pixmap = QPixmap::fromImage(image);
    int width = ui->label_20->width();
    int height = ui->label_20->height();
    QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
    ui->label_20->setPixmap(fitpixmap);
}

//抽血图片上传
void modFirstInfo::on_pushButton_2_clicked()
{
    blood_path = QFileDialog::getOpenFileName(nullptr, "文件上传", "", "");
    qDebug() << blood_path;
    QImage image;
    image.load(blood_path);
    QPixmap pixmap = QPixmap::fromImage(image);
    int width = ui->label_21->width();
    int height = ui->label_21->height();
    QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
    ui->label_21->setPixmap(fitpixmap);
}

//技检图片上传
void modFirstInfo::on_pushButton_3_clicked()
{
    technical_path = QFileDialog::getOpenFileName(nullptr, "文件上传", "", "");
    qDebug() << technical_path;
    QImage image;
    image.load(technical_path);
    QPixmap pixmap = QPixmap::fromImage(image);
    int width = ui->label_22->width();
    int height = ui->label_22->height();
    QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
    ui->label_22->setPixmap(fitpixmap);
}

//量表图片上传
void modFirstInfo::on_pushButton_4_clicked()
{
    scale_path = QFileDialog::getOpenFileName(nullptr, "文件上传", "", "");
    qDebug() << scale_path;
    QImage image;
    image.load(scale_path);
    QPixmap pixmap = QPixmap::fromImage(image);
    int width = ui->label_23->width();
    int height = ui->label_23->height();
    QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
    ui->label_23->setPixmap(fitpixmap);
}

//诊断图片上传
void modFirstInfo::on_pushButton_5_clicked()
{
    diagnosis_path = QFileDialog::getOpenFileName(nullptr, "文件上传", "", "");
    qDebug() << diagnosis_path;
    QImage image;
    image.load(diagnosis_path);
    QPixmap pixmap = QPixmap::fromImage(image);
    int width = ui->label_24->width();
    int height = ui->label_24->height();
    QPixmap fitpixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
    ui->label_24->setPixmap(fitpixmap);
}
